<template>
  <div class="warn-tips">
    <el-alert
    :title="getTitle('进入雷达范围',radarList)"
    type="error" v-if="radarList.length">
  </el-alert>
   <el-alert
    :title="getTitle('进入动态墙范围',wallList)"
    type="error" v-if="wallList.length">
  </el-alert>
  </div>
</template>

<script>
import {vm,SEND} from '../../utils/eventManage'
export default {
  components: {},
  data() {
    return {
        wallList:[],
       radarList:[]
    };
  },
  mounted() {
      vm.$on(SEND.updateRadarList,data=>this.updateRadarList(data))
       vm.$on(SEND.updateWallList,data=>this.updateWallList(data))
  },
  methods: {
      updateRadarList(data){
          this.radarList=data.list
      },
      updateWallList(data){
          this.wallList=data.list
      },
      getTitle(label,list){
          let names=this.getListName(list)
          return `${label}：${names}`
      },
      getListName(list){
        let arrName = list.map(d=>d.info.name);
        return arrName.join(',')
        }
  },
  created() {}
};
</script>
<style lang="less" scoped>
.warn-tips{
    position: absolute;
    top: 0px;
    left: 50%;
    width: 400px;
    transform: translateX(-50%);
    z-index: 5;
}
</style>
